import { Exclude } from 'class-transformer'
import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn
} from 'typeorm'

@Entity('USER')
export class UserEntity {
  @PrimaryGeneratedColumn()
  id: number

  @Column({ type: 'char', length: 20 })
  name: string

  @Column({ type: 'char', length: 20, nullable: true })
  mobile: string

  @Column({ type: 'char', length: 50, nullable: true })
  email: string

  @Column({ type: 'varchar', length: 200, nullable: true })
  desc: string

  @Column({ default: 'enable' })
  status: 'disable' | 'enable'

  @Exclude({ toPlainOnly: true })
  @Column({ type: 'char', length: 200 })
  password: string

  @CreateDateColumn()
  create_date: Date
}
